﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SaiLing.SingleSignOn.Domain.Entities.System;

namespace SaiLing.SingleSignOn.Repository.Mapping.System
{
   public class ModuleMapping: IEntityTypeConfiguration<Module>
    {
        public void Configure(EntityTypeBuilder<Module> builder)
        {
            builder.HasMany(x => x.Actions).WithOne().HasForeignKey(x => x.ModuleId);
            builder.Ignore(x=>x.Level);
            builder.ToTable("SaiLing_System_Module");
        }
    }

    public class ModuleActionMapping : IEntityTypeConfiguration<ModuleAction>
    {
        public void Configure(EntityTypeBuilder<ModuleAction> builder)
        {
            builder.ToTable("SaiLing_System_ModuleAction");
        }
    }
}
